﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace newTask
{
    public static class Program

    {
        //This example creates a new Task and immediately starts it. Calling Wait is equivalent to
        //calling Join on a thread. It waits till the Task is finished before exiting the application.

        public static void Main()

        {

            Task t = Task.Run(() =>

            {

                for (int x = 0; x < 10; x++)

                {

                    Console.Write("*");
                    Thread.Sleep(1000);
                }

            });

            t.Wait();

        }

    }
}
